public class Gloves {
    public int findMinimum(int n, int[] left, int[] right) {
       int leftsum=0;
       int rightsum=0;
       int sum=0;
       int leftMin=Integer.MAX_VALUE;
       int rightMin=Integer.MAX_VALUE;
       for(int i=0;i<n;i++){
        if(left[i]*right[i]==0){
            sum=sum+left[i]+right[i];//对应的零
        }else{
            leftsum=leftsum+left[i];
            rightsum= rightsum+right[i];
            leftMin=Math.min(leftMin,left[i]);
            rightMin=Math.min(rightMin,right[i]);
        }
       }
     int tmp=sum+Math.min(leftsum-leftMin+1,rightsum-rightMin+1);
     return tmp+1;
    }
}